#include "MEFMain.h"
//#include "MEFBuilderSimple.h"
//#include "MEFXMLParser.h"
//#include "MEFPluginIF.h"
#include <iostream>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif

CMEFMain::CMEFMain(void)
{
}

CMEFMain::~CMEFMain(void)
{
}

void CMEFMain::Setup()
{
	iDevice = createDevice(video::EDT_DIRECT3D8, core::dimension2d<s32>(640,480));
	iDriver = iDevice->getVideoDriver();
	iScenemgr = iDevice->getSceneManager();

	iDevice->setWindowCaption(L"Hello World!");
	//CMEFBuilderSimple* builder = new CMEFBuilderSimple();
	//CMEFXMLParser* parser = new CMEFXMLParser();
	
	//parser->ParseFile("..\\Content\\XML\\ui.xml", *this);

	//delete parser;
	//delete builder;
}

void CMEFMain::Run()
{
	while(iDevice->run() && iDriver)
	{
		if (iDevice->isWindowActive())
		{
			iDriver->beginScene(true, true, video::SColor(255,19,47,90));
			iScenemgr->drawAll();
			iDevice->getGUIEnvironment()->drawAll();
			iDriver->endScene();
		}
	}
}

void CMEFMain::TearDown()
{
	iDevice->drop();
}